import { DynamicModule, Module } from '@nestjs/common';
import {
  WechatModuleAsyncOptions,
  WechatModuleOptions,
} from './wechat.interface';

import { WechatCoreModule } from './wechat-core.module';

@Module({})
export class WechatModule {
  static register(
    options: WechatModuleOptions | WechatModuleOptions[],
  ): DynamicModule {
    return {
      module: WechatModule,
      imports: [WechatCoreModule.register(options)],
    };
  }

  static forRootAsync(options: WechatModuleAsyncOptions): DynamicModule {
    return {
      module: WechatModule,
      imports: [WechatCoreModule.forRootAsync(options)],
    };
  }
}
